package com.semidata.trp.decision.request;

import com.semidata.rtd.core.iplib.Area;
import com.semidata.rtd.core.iplib.IpLibService;
import com.semidata.rtd.core.service.ServiceManager;
import com.semidata.trp.decision.utils.Utils;

public class Request {
	private String userId;
	private int positionId;
	private String ip;
	private Area area;
	private long timestamp;
	private int hour;
	private String callback;
	private String keyword1;
	private String keyword2;
	private String keyword3;
	
	private static IpLibService ipLibService = ServiceManager.getService(IpLibService.class);
	
	public Request(){
		this.userId = "";
		this.positionId = -1;
		this.ip = null;
		this.area = null;
		this.callback = null;
		this.keyword1 = null;
		this.keyword2 = null;
		this.keyword3 = null;
		this.timestamp = System.currentTimeMillis();
		this.hour = Utils.getHour(timestamp);
	}

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public int getPositionId() {
        return positionId;
    }

    public void setPositionId(int positionId) {
        this.positionId = positionId;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
        this.area = ipLibService.getArea(ip);
    }

    public long getTimestamp() {
        return timestamp;
    }

    public Area getArea() {
        return area;
    }
    
    public int getHour() {
        return hour;
    }

    public String getCallback() {
        return callback;
    }

    public void setCallback(String callback) {
        this.callback = callback;
        
    }

	public String getKeyword1() {
		return keyword1;
	}

	public void setKeyword1(String keyword1) {
		this.keyword1 = keyword1;
	}

	public String getKeyword2() {
		return keyword2;
	}

	public void setKeyword2(String keyword2) {
		this.keyword2 = keyword2;
	}

	public String getKeyword3() {
		return keyword3;
	}

	public void setKeyword3(String keyword3) {
		this.keyword3 = keyword3;
	}
    
    
    
    
}
